package com.sunday.common.mq.kafka.study.spring.e20_Brave_Trace;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaHandler;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Slf4j
@Component
@KafkaListener(
        id = "myId_15_B",
        topics = "topic15",
        clientIdPrefix = "TEST15_B"
)
public class MultiListenerBean {

    //    @KafkaHandler
    public void listenStr(String record) {
        log.info("[listen15_B][string][收到测试消息] message = {}", record);
    }

    @KafkaHandler(isDefault = true)
    public void listenRecord(ConsumerRecord<String, String> record) throws InterruptedException {
        log.info("[listen15_B][record][收到测试消息] message = {}", record.value());
        TimeUnit.SECONDS.sleep(5);
    }

}
